//
//  ParagraphAttributeConfig.m
//  MyFunctionDemo
//
//  Created by Ting Han on 2017/9/1.
//  Copyright © 2017年 Ting Han. All rights reserved.
//

#import "ParagraphAttributeConfig.h"

@implementation ParagraphAttributeConfig

- (NSString *)attributeName{
    return NSParagraphStyleAttributeName;
}
- (id)attributeValue{
    if (self.paragraphStyle) {
        return self.paragraphStyle;
    }else{
        return [NSParagraphStyle defaultParagraphStyle];
    }
}
+ (instancetype)configWithParagraphStyle:(NSMutableParagraphStyle *)paragraphStyle{
    ParagraphAttributeConfig *config = [[[self class]alloc]init];
    config.paragraphStyle = paragraphStyle;
    return config;
}
+ (instancetype)configWithParagraphStyle:(NSMutableParagraphStyle *)paragraphStyle range:(NSRange)range{
    ParagraphAttributeConfig *config = [[[self class]alloc]init];
    config.paragraphStyle = paragraphStyle;
    config.effectiveStringRange = range;
    return config;
}

@end
